﻿

using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;


public class BLL_tbl_employee_master
{
    public BLL_tbl_employee_master()
    {

    }

    public List<tbl_employee_master> select(String USER_CODE)
    {
        DAL_tbl_employee_master dal = new DAL_tbl_employee_master();
        return dal.select(USER_CODE);
    }

    public List<tbl_employee_master> selectAll()
    {
        DAL_tbl_employee_master dal = new DAL_tbl_employee_master();
        return dal.selectAll();
    }

    public DataTable selectAllForGrid()
    {
        DAL_tbl_employee_master dal = new DAL_tbl_employee_master();
        return dal.selectAllForGrid();
    }

    public List<tbl_employee_master> selectAllWithFullEmpName()
    {
        DAL_tbl_employee_master dal = new DAL_tbl_employee_master();
        List<tbl_employee_master> list = dal.selectAll();
        foreach (tbl_employee_master emp in list)
        {
            emp.FIRST_NAME = emp.FIRST_NAME + " " + emp.LAST_NAME;
        }
        return list;
    }

    public bool insert(tbl_employee_master tbl)
    {
        DAL_tbl_employee_master dal = new DAL_tbl_employee_master();
        int i = 0;
        i = dal.insert(
            tbl.USER_CODE
, tbl.USER_ROLE_ID
, tbl.FIRST_NAME
, tbl.LAST_NAME
, tbl.DEPARTMENT_ID
, tbl.DESIGNATION_ID
, tbl.CREATED_BY
, tbl.CREATED_DATE
        );

        return Convert.ToBoolean(i);
    }


    public bool update(tbl_employee_master tbl)
    {
        DAL_tbl_employee_master dal = new DAL_tbl_employee_master();
        int i = 0;
        i = dal.update(
            tbl.USER_CODE
, tbl.USER_ROLE_ID
, tbl.FIRST_NAME
, tbl.LAST_NAME
, tbl.DEPARTMENT_ID
, tbl.DESIGNATION_ID
, tbl.UPDATED_BY
, tbl.UPDATED_DATE
            );

        return Convert.ToBoolean(i);
    }


    public bool delete(tbl_employee_master tbl)
    {
        DAL_tbl_employee_master dal = new DAL_tbl_employee_master();
        int i = 0;
        i = dal.delete(
                tbl.USER_CODE
        );

        return Convert.ToBoolean(i);
    }


}

